﻿namespace CodePlex.Logistics.Web
{
    using Microsoft.AspNet.Identity;
    using Microsoft.Owin;
    using Microsoft.Owin.Security.Cookies;
    using Owin;
    using System.Security.Claims;
    using System.Web.Helpers;

    public partial class Startup
    {
        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Active,
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                CookieName = "CODEPLEX_LOGISTICS",
                LoginPath = new PathString("/Login"),
                //CookieSecure = CookieSecureOption.Always,
                ExpireTimeSpan = new System.TimeSpan(14, 0, 0, 0),
                SlidingExpiration = true
            });

            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
        }
    } // public partial class Startup
} // namespace CodePlex.Logistics.Web